package com.smedi.ismedi.authoritymanagement.api.feign;

import com.smedi.ismedi.authoritymanagement.api.dto.request.*;
import com.smedi.ismedi.authoritymanagement.api.dto.response.*;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: xulinjun
 * @Date: 2021-7-15 15:46
 */
@Api(tags = {"权限管理基础构件配置接口"})
@FeignClient(name = "ismedi-authority-management")
@RequestMapping(value = "/api/v1/authority/infrastructure")
public interface RemoteAuthorityInfrastructureFeignApi {
    /**
     * 保存菜单
     *
     * @param termMenuRequests
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "保存菜单")
    @PostMapping(value = "/save/term/menu")
    ResponseData<List<TermMenuResponse>> postSaveTermMenu(@Validated @RequestBody List<TermMenuRequest> termMenuRequests);

    /**
     * 保存页面
     *
     * @param termPageRequests
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "保存页面")
    @PostMapping(value = "/save/term/page")
    ResponseData<List<TermPageResponse>> postSaveTermPage(@Validated @RequestBody List<TermPageRequest> termPageRequests);

    /**
     * 保存路由
     *
     * @param termRouterRequests
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "保存路由")
    @PostMapping(value = "/save/term/router")
    ResponseData<List<TermRouterResponse>> postSaveTermRouter(@Validated @RequestBody List<TermRouterRequest> termRouterRequests);

    /**
     * 获取菜单
     *
     * @param termId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "获取菜单")
    @GetMapping(value = "/queryTermMenu")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "termId", value = "构件", dataType = "Long", dataTypeClass = Long.class)
    })
    ResponseData<TermMenuResponse> getQueryTermMenu(@RequestParam("termId") Long termId);

    /**
     * 获取页面
     *
     * @param termId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "获取页面")
    @GetMapping(value = "/queryTermPage")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "termId", value = "构件", dataType = "Long", dataTypeClass = Long.class)
    })
    ResponseData<TermPageResponse> getQueryTermPage(@RequestParam("termId") Long termId);

    /**
     * 获取路由
     *
     * @param termId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "获取路由")
    @GetMapping(value = "/queryTermRouter")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "termId", value = "构件", dataType = "Long", dataTypeClass = Long.class)
    })
    ResponseData<TermRouterResponse> getQueryTermRouter(@RequestParam("termId") Long termId);

    /**
     * 保存构建类型定义
     *
     * @param termRelationshipGroupRequests
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "保存构建类型定义")
    @PostMapping(value = "/save/role/permissionType")
    ResponseData<List<TermRelationshipGroupResponse>> postSaveRolePermissionType(@Validated @RequestBody List<TermRelationshipGroupRequest> termRelationshipGroupRequests);

    /**
     * 保存系统框架结构
     *
     * @param frameStructureRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "保存系统框架结构")
    @PostMapping(value = "/save/define/frameStructure")
    ResponseData<FrameStructureResponse> postSaveFrameStructure(@Validated @RequestBody FrameStructureRequest frameStructureRequest);

    /**
     * 获获取系统框架结构，用于系统架构树维护界面、角色权限组维护界面显示组织结构树
     *
     * @param queryFrameStructureRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "获取系统框架结构，用于系统架构树维护界面、角色权限组维护界面显示组织结构树")
    @PostMapping(value = "/queryFrameStructureByRootCode")
    ResponseData<WebClientStructureResponse> getQueryFrameStructureByRootCode(@Validated @RequestBody QueryFrameStructureRequest queryFrameStructureRequest);
}
